package com.hundsun.s3.mrs.core.type;

import java.util.HashMap;
import java.util.Map;

import com.hundsun.s3.mrs.core.handler.IHandler;

/**
 * 类别管理器
 * @author chenji23607
 *
 */
public class Type2HandlerManager {
	
	/**
	 * key为类别
	 * value为对应的处理器
	 */
	private  static Map<String, IHandler> type2Handler = new HashMap<>();

	public static Map<String, IHandler> getType2Handler() {
		return type2Handler;
	}

	public static void setType2Handler(Map<String, IHandler> type2Handler) {
		Type2HandlerManager.type2Handler = type2Handler;
	}
	
	public static void addMapper(String type, IHandler handler) {
		type2Handler.put(type, handler);
	}
	
	public static void removeMapper(String type) {
		type2Handler.remove(type);
	}
	
	public static IHandler get(String key) {
		return type2Handler.get(key);
	}
}
